package exhibition.app.nexd.cn.application;

import android.app.Application;

import com.litesuits.orm.LiteOrm;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import exhibition.app.nexd.cn.model.OrderForm;
import exhibition.app.nexd.cn.model.Hire;

/**
 * Created by xun on 2016/4/18.
 */
public class NexdApplication extends Application {
    public static NexdApplication nexdApplication;
    Map<Integer, OrderForm> orderFormMap;
    List<Hire> hires = new ArrayList<>();
    private int userId;
    private String phoneNum;
    LiteOrm liteOrm;
    public static boolean IS_HAVE_ORDER = false;

    public List<Hire> getHires() {
        return hires;
    }

    public void setHires(ArrayList<Hire> hireArrayList){
        hires.clear();
        hires.addAll(hireArrayList);
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getUserId() {
        return userId;
    }

    public Map<Integer, OrderForm> getOrderFormMap() {
        return orderFormMap;
    }


    @Override
    public void onCreate() {
        super.onCreate();
        nexdApplication = this;
        orderFormMap = new HashMap<>();
        createLiteORM();
    }

    public void createLiteORM() {
        liteOrm = LiteOrm.newSingleInstance(this, "exhibition.db");
        liteOrm.setDebugged(true);
    }

    public LiteOrm getLiteOrm() {
        return liteOrm;
    }

    public NexdApplication() {
    }

    public static NexdApplication getInstance() {
        return nexdApplication;
    }
}
